﻿using UnityEngine;
using System.Collections;
using System.IO;
public class FSMControl1 :MonoBehaviour{
	float savetime;
	public void Update(){
		savetime += Time.deltaTime;
		if (savetime >= 2) {
			for (int i = 0; i < 50; i++) {
				FSMTester texter = new FSMTester ();

				SimpleFSMTester testersimple = new SimpleFSMTester ();
			}
			savetime = 0;
		}
	}
}
public class FSMTester{
	public FSM _state;
	protected StatePath _null = new StatePath ("null");
	protected StatePath _attackIdle = new StatePath("idle");
	protected StatePath _attack = new StatePath("attack"); //攻击
	protected StatePath _hit = new StatePath("hit"); // 受击
	protected StatePath _die = new StatePath("die");

	protected StatePath _moveTarget = new StatePath("moveTarget"); // 朝移动点移动
	protected StatePath _moveTianshen = new StatePath ("moveTianshen"); // 朝天神移动
	protected StatePath _flick = new StatePath("flick"); // 朝当前正前方的反方向弹开
	protected StatePath _playBuff = new StatePath("playBuff");
	protected StatePath _look = new StatePath ("look");

	#region 出场方式一  状态
	protected StatePath _showone = new StatePath("Showone");
	protected StatePath _showone_jump_up = new StatePath("Showone/jump_up");
	protected StatePath _showone_jump_sky = new StatePath("Showone/jump_sky");
	protected StatePath _showone_jump_down = new StatePath("Showone/jump_down");
	protected StatePath _showone_fall_up = new StatePath("Showone/fall_up");
	protected StatePath _showone_fall_ground = new StatePath ("Showone/fall_ground");
	protected StatePath _showone_fall_down = new StatePath("Showone/fall_down");
	protected StatePath _showone_idle = new StatePath("ShowOne/idle");
	protected StatePath _showone_walk = new StatePath ("Showone/walk");
	#endregion

	protected StatePath _showtwo = new StatePath("Showtwo");
	protected StatePath _Showtwo_breakingDown = new StatePath("ShowTwo/breakingDown");
	protected StatePath _showtwo_fall_ground = new StatePath ("ShowTwo/fall_ground");
	protected StatePath _showtwo_fall_up = new StatePath("ShowTwo/fall_up");
	protected StatePath _showtwo_walk = new StatePath ("ShowTwo/walk");
	public FSMTester(){
		_state = new FSM ();
		_state.AddState(_null);
		_state.AddState (_look);
		_state.AddState (_moveTarget);
		_state.AddState (_moveTianshen);
		_state.AddState (_hit);
		_state.AddState (_flick);
		_state.AddState (_attack);
		_state.AddState (_die);
		_state.AddState (_playBuff);
		_state.AddState (_attackIdle);

		_state.AddStateMachine (_showone);
		_state.AddStateMachine (_showtwo);
		// 出场方式一的状态机
		_state.AddState (_showone_jump_up);
		_state.AddState (_showone_jump_sky);
		_state.AddState (_showone_jump_down);
		_state.AddState (_showone_fall_up);
		_state.AddState (_showone_fall_ground);
		_state.AddState (_showone_fall_down);
		_state.AddState (_showone_idle);
		_state.AddState (_showone_walk);
		// 出场方式二的状态机
		_state.AddState (_Showtwo_breakingDown);
		//		_state.AddState (_showtwo_fall_ground, OnShowTwoFallGroundEnter, OnShowTwoFallGroundUpdate);
		//		_state.AddState (_showtwo_fall_up, OnShowTwoFallUpEnter, OnShowTwoFallUpUpdate);
		_state.AddState (_showtwo_walk);
	}
}

public class SimpleFSMTester{
	SimpleFSM _state ;
//	protected StatePath _null = new StatePath ("null");
//	protected StatePath _attackIdle = new StatePath("idle");
//	protected StatePath _attack = new StatePath("attack"); //攻击
//	protected StatePath _hit = new StatePath("hit"); // 受击
//	protected StatePath _die = new StatePath("die");
//
//	protected StatePath _moveTarget = new StatePath("moveTarget"); // 朝移动点移动
//	protected StatePath _moveTianshen = new StatePath ("moveTianshen"); // 朝天神移动
//	protected StatePath _flick = new StatePath("flick"); // 朝当前正前方的反方向弹开
//	protected StatePath _playBuff = new StatePath("playBuff");
//	protected StatePath _look = new StatePath ("look");
//
//	#region 出场方式一  状态
//	protected StatePath _showone = new StatePath("Showone");
//	protected StatePath _showone_jump_up = new StatePath("Showone/jump_up");
//	protected StatePath _showone_jump_sky = new StatePath("Showone/jump_sky");
//	protected StatePath _showone_jump_down = new StatePath("Showone/jump_down");
//	protected StatePath _showone_fall_up = new StatePath("Showone/fall_up");
//	protected StatePath _showone_fall_ground = new StatePath ("Showone/fall_ground");
//	protected StatePath _showone_fall_down = new StatePath("Showone/fall_down");
//	protected StatePath _showone_idle = new StatePath("ShowOne/idle");
//	protected StatePath _showone_walk = new StatePath ("Showone/walk");
//	#endregion
//
//	protected StatePath _showtwo = new StatePath("Showtwo");
//	protected StatePath _Showtwo_breakingDown = new StatePath("ShowTwo/breakingDown");
//	protected StatePath _showtwo_fall_ground = new StatePath ("ShowTwo/fall_ground");
//	protected StatePath _showtwo_fall_up = new StatePath("ShowTwo/fall_up");
//	protected StatePath _showtwo_walk = new StatePath ("ShowTwo/walk");

	protected SimpleState _null;
	protected SimpleState _attackIdle;
	protected SimpleState _attack;
	protected SimpleState _hit;
	protected SimpleState _die ;

	protected SimpleState _moveTarget;
	protected SimpleState _moveTianshen;
	protected SimpleState _flick ;
	protected SimpleState _playBuff;
	protected SimpleState _look;

	#region 出场方式一  状态
	protected SimpleState _showone;
	protected SimpleState _showone_jump_up;
	protected SimpleState _showone_jump_sky;
	protected SimpleState _showone_jump_down;
	protected SimpleState _showone_fall_up;
	protected SimpleState _showone_fall_ground;
	protected SimpleState _showone_fall_down;
	protected SimpleState _showone_idle;
	protected SimpleState _showone_walk;
	#endregion

	protected SimpleState _showtwo;
	protected SimpleState _Showtwo_breakingDown;
	protected SimpleState _showtwo_fall_ground;
	protected SimpleState _showtwo_fall_up;
	protected SimpleState _showtwo_walk;
	public SimpleFSMTester(){
		_state = new SimpleFSM ();
//		_null = new SimpleState (null, null, null);
//		_attackIdle = new SimpleState (null, null, null);
//		_attack = new SimpleState (null, null, null);
//		_hit = new SimpleState (null, null, null);
//		_die = new SimpleState (null, null, null);
//		_moveTarget = new SimpleState (null, null, null);
//		_moveTianshen = new SimpleState (null, null, null);
//		_flick = new SimpleState (null, null, null);
//		_playBuff = new SimpleState (null, null, null);
//		_look = new SimpleState (null, null, null);
//		_showone = new SimpleState (null, null, null);
//		_showone_jump_up = new SimpleState (null, null, null);
//		_showone_jump_sky = new SimpleState (null, null, null);
//		_showone_jump_down = new SimpleState (null, null, null);
//		_showone_fall_up = new SimpleState (null, null, null);
//		_showone_fall_ground = new SimpleState (null, null, null);
//		_showone_fall_down = new SimpleState (null, null, null);
//		_showone_idle = new SimpleState (null, null, null);
//		_showone_walk = new SimpleState (null, null, null);
//		_showtwo = new SimpleState (null, null, null);
//		_Showtwo_breakingDown = new SimpleState (null, null, null);
//		_showtwo_fall_ground = new SimpleState (null, null, null);
//		_showtwo_fall_up = new SimpleState (null, null, null);
//		_showtwo_walk = new SimpleState (null, null, null);
//		_state.AddState(_null);
//		_state.AddState (_look);
//		_state.AddState (_moveTarget);
//		_state.AddState (_moveTianshen);
//		_state.AddState (_hit);
//		_state.AddState (_flick);
//		_state.AddState (_attack);
//		_state.AddState (_die);
//		_state.AddState (_playBuff);
//		_state.AddState (_attackIdle);
//
//		// 出场方式一的状态机
//		_state.AddState (_showone_jump_up);
//		_state.AddState (_showone_jump_sky);
//		_state.AddState (_showone_jump_down);
//		_state.AddState (_showone_fall_up);
//		_state.AddState (_showone_fall_ground);
//		_state.AddState (_showone_fall_down);
//		_state.AddState (_showone_idle);
//		_state.AddState (_showone_walk);
//		// 出场方式二的状态机
//		_state.AddState (_Showtwo_breakingDown);
//		//		_state.AddState (_showtwo_fall_ground, OnShowTwoFallGroundEnter, OnShowTwoFallGroundUpdate);
//		//		_state.AddState (_showtwo_fall_up, OnShowTwoFallUpEnter, OnShowTwoFallUpUpdate);
//		_state.AddState (_showtwo_walk);
	}
}